import axios from "axios";
export default function ajax(url,data={},type="get"){
    return new Promise((resolve,reject)=>{
        let promise
        const qs = require('querystring')
        if(type=="get"){
            promise = axios.get(url,{params:data})
        }else{
            promise = axios.post(url,qs.stringify(data))
        }
        promise.then((res)=>{
            resolve(res)
        })
    })
}